<!DOCTYPE html PUBLIC "-//W3C//DTD html 4.01 Transitional//EN">
<html >
	<head >
		<?php echo $header; ?>
	</head>
	<body>
		<div id="" class="header"><?php echo $title; ?></div>
		<?php echo form_open_multipart("demands/eJ", array('cif_name'=>'edit_demands_form'))?>
		<script type="text/javascript">
			function ChangeArea(div_id){
				if(div_id == 'n_1') {
					document.getElementById('n_1').style.display='block';
					document.getElementById('t_1').style.background='#FFF';
				}
				else {
					document.getElementById('n_1').style.display='none';
					document.getElementById('t_1').style.background='#F3FCF5';
				} 
				if(div_id == 'n_2') { 
					document.getElementById('n_2').style.display='block';
					document.getElementById('t_2').style.background='#FFF';
				} 
				else {
					document.getElementById('n_2').style.display='none';
					document.getElementById('t_2').style.background='#F3FCF5';
				} 
				if(div_id == 'n_3') {
					document.getElementById('n_3').style.display='block'; 
					document.getElementById('t_3').style.background='#FFF';
				}	
				else {	
					document.getElementById('n_3').style.display='none';
					document.getElementById('t_3').style.background='#F3FCF5';
				}
				if(div_id == 'n_4') {
					document.getElementById('n_4').style.display='block'; 
					document.getElementById('t_4').style.background='#FFF';
				}
				else {
					document.getElementById('n_4').style.display='none';
					document.getElementById('t_4').style.background='#F3FCF5';
				}
				return false; 
			}
		</script>
		<table width="90%" class="tbl" cellpadding="5">
			<tr>
				<td id="t_1" style="background-color:#FFF;border: 1px solid #CCCCCC;" nowrap="nowrap"><a href="#" onclick="ChangeArea('n_1');return false;">Детали документа</a></td>
				<td id="t_2" style="background-color:#F3FCF5;border: 1px solid #CCCCCC;" nowrap="nowrap"><a href="#" onclick="ChangeArea('n_2');return false;">Детали тура</a></td>
				<td id="t_4" style="background-color:#F3FCF5;border: 1px solid #CCCCCC;" nowrap="nowrap"><a href="#" onclick="ChangeArea('n_4');return false;">Участники тура</a></td>
				<td id="t_3" style="background-color:#F3FCF5;border: 1px solid #CCCCCC;" nowrap="nowrap"><a href="#" onclick="ChangeArea('n_3');return false;">Оплата тура</a></td>
				<td width="50%"></td>
			</tr>
		</table>
		<div id="n_1">
		<fieldset width="90%"> 
		<legend>Данные документа</legend>
		<table width="90%" class="tbl">
		<tr>
			<td>
				<?php echo $date_doc; ?>
			</td>
			<td>
				<?php echo $date_doc_field; ?>
			</td>
			<td>
				<?php echo $_demandsstatuses_rid; ?>
			</td>
			<td>
				<?php echo $_demandsstatuses_rid_field; ?><br>
				<font color="red"><?php echo $this->validation->_demandsstatuses_rid_error; ?></font>
			</td>
		</tr>
		<tr>
			<td>
				<?php echo $_advertisessources_rid; ?>
			</td>
			<td colspan="10">
				<?php echo $_advertisessources_rid_field; ?><br>
				<font color="red"><?php echo $this->validation->_advertisessources_rid_error; ?></font>
			</td>
		</tr>
		</table>
		<table width="100%" class="tbl">
		<tr>
			<td>
				<?php echo $descr; ?>
			</td>
			<td>
				<?php echo $descr_field; ?><br>
				<font color="red"><?php echo $this->validation->descr_error; ?></font>
			</td>
		</tr>
		<tr>
			<td>
				<?php echo $archive; ?>
			</td>
			<td>
				<?php echo $archive_field; ?><br>
				<font color="red"><?php echo $this->validation->archive_error; ?></font>
			</td>
		</tr>
		</table>
		</fieldset>
		</div>
		<div id="n_2" style="display: none;">
		<fieldset>
		<legend><?php echo $this->lang->line('TOUR_DETAILS'); ?></legend>
		<table width="100%" class="tbl">
		<tr>
			<td>
				<?php echo $_touroperators_rid; ?>
			</td>
			<td>
				<?php echo $_touroperators_rid_field; ?><br>
				<font color="red"><?php echo $this->validation->_touroperators_rid_error; ?></font>
			</td>
			<td>
				<?php echo $_countries_rid; ?>
			</td>
			<td>
				<?php echo $_countries_rid_field; ?><br>
				<font color="red"><?php echo $this->validation->_countries_rid_error; ?></font>
			</td>
		</tr>
		<tr>
			<td>
				<?php echo $_curourts_rid; ?>
			</td>
			<td>
				<?php echo $_curourts_rid_field; ?>
				<font color="red"><?php echo $this->validation->_curourts_rid_error; ?></font>
			</td>
			<td>
				<?php echo $city_name; ?>
			</td>
			<td>
				<?php echo $city_name_field; ?><br>
				<font color="red"><?php echo $this->validation->city_name_error; ?></font>
			</td>
		</tr>
		<tr>
			<td>
				<?php echo $hotel_name; ?>
			</td>
			<td>
				<?php echo $hotel_name_field; ?><br>
				<font color="red"><?php echo $this->validation->hotel_name_error; ?></font>
			</td>
			<td>
				<?php echo $_hotelscats_rid; ?>
			</td>
			<td>
				<?php echo $_hotelscats_rid_field; ?><br>
				<font color="red"><?php echo $this->validation->_hotelscats_rid_error; ?></font>
			</td>
		</tr>
		<tr>
			<td>
				<?php echo $_rooms_rid; ?>
			</td>
			<td>
				<?php echo $_rooms_rid_field; ?><br>
				<font color="red"><?php echo $this->validation->_rooms_rid_error; ?></font>
			</td>
			<td>
				<?php echo $room_cat; ?>
			</td>
			<td>
				<?php echo $room_cat_field; ?><br>
				<font color="red"><?php echo $this->validation->room_cat_error; ?></font>
			</td>
		</tr>
		<tr>
			<td>
				<?php echo $_food_rid; ?>
			</td>
			<td>
				<?php echo $_food_rid_field; ?><br>
				<font color="red"><?php echo $this->validation->_food_rid_error; ?></font>
			</td>
			<td>
				<?php echo $transfer; ?>
			</td>
			<td>
				<?php echo $transfer_field; ?><br>
				<font color="red"><?php echo $this->validation->transfer_error; ?></font>
			</td>
		</tr>
		<tr>
			<td>
				<?php echo $date_from; ?>
			</td>
			<td>
				<?php echo $date_from_field; ?><br>
				<font color="red"><?php echo $this->validation->date_from_error; ?></font>
			</td>
			<td>
				<?php echo $date_to; ?>
			</td>
			<td>
				<?php echo $date_to_field; ?><br>
				<font color="red"><?php echo $this->validation->date_to_error; ?></font>
			</td>
		</tr>
		<tr>
			<td>
				<?php echo $excursions; ?>
			</td>
			<td colspan="10">
				<?php echo $excursions_field; ?><br>
				<font color="red"><?php echo $this->validation->excursions_error; ?></font>
			</td>
		</tr>
		</table>
		</fieldset>
		</div>
		<div id="n_3" style="display: none;">
		<fieldset>
		<legend>Оплата</legend>
		<table width="100%" class="tbl">
		<tr>
			<td>
				<?php echo $summ_tour; ?>
			</td>
			<td>
				<?php echo $summ_tour_field; ?><br>
				<font color="red"><?php echo $this->validation->summ_tour_error; ?></font>
			</td>
			<td>
				<?php echo $_tcurrencies_rid; ?>
			</td>
			<td>
				<?php echo $_tcurrencies_rid_field; ?><br>
				<font color="red"><?php echo $this->validation->_tcurrencies_rid_error; ?></font>
			</td>
			<td>
				<?php echo $curr_cource; ?>
			</td>
			<td>
				<?php echo $curr_cource_field; ?><br>
				<font color="red"><?php echo $this->validation->curr_cource_error; ?></font>
			</td>
		</tr>
		<tr>
			<td>
				<?php echo $discount_per; ?>
			</td>
			<td>
				<?php echo $discount_per_field; ?><br>
				<font color="red"><?php echo $this->validation->discount_per_error; ?></font>
			</td>
			<td>
				<?php echo $discount_fix; ?>
			</td>
			<td>
				<?php echo $discount_fix_field; ?><br>
				<font color="red"><?php echo $this->validation->discount_fix_error; ?></font>
			</td>
			<td>
				<?php echo $bank_s; ?>
			</td>
			<td>
				<?php echo $bank_s_field; ?><br>
				<font color="red"><?php echo $this->validation->bank_s_error; ?></font>
			</td>
		</tr>
		<tr>
			<td>
				<?php echo $touroperator_commision; ?>
			</td>
			<td>
				<?php echo $touroperator_commision_field; ?><br>
				<font color="red"><?php echo $this->validation->discount_per_error; ?></font>
			</td>
			<td>
				<?php echo $touroperator_koeff; ?>
			</td>
			<td colspan="5">
				<?php echo $touroperator_koeff_field; ?><br>
				<font color="red"><?php echo $this->validation->touroperator_koeff_error; ?></font>
			</td>
		</tr>
		<tr>
			<td>
				<?php echo $summ; ?>
			</td>
			<td>
				<?php echo $summ_field; ?><br>
				<font color="red"><?php echo $this->validation->summ_error; ?></font>
			</td>
			<td>
				<?php echo $summ_pay; ?>
			</td>
			<td>
				<?php echo $summ_pay_field; ?><br>
				<font color="red"><?php echo $this->validation->summ_pay_error; ?></font>				
			</td>
			<td>
				<?php echo $rest; ?>
			</td>
			<td>
				<?php echo $rest_field; ?><?php echo $_currencies_rid_field; ?><br>
			</td>
		</tr>
		<tr>
			<td>
				<?php echo $summ_text; ?>
			</td>
			<td colspan="5">
				<?php echo $summ_text_field; ?><br>
				<font color="red"><?php echo $this->validation->summ_text_error; ?></font>
			</td>
		</tr>
		<tr>
			<td>
				<?php echo $order_summ; ?>
			</td>
			<td>
				<?php echo $order_summ_field; ?><br>
				<font color="red"><?php echo $this->validation->order_summ_error; ?></font>
			</td>
			<td>
				<?php echo $order_image; ?>
			</td>
			<td colspan="2">
				<?php echo $order_image_field; ?><br>
				<font color="red"><?php echo $this->validation->order_image_error; ?></font>
			</td>
		</tr>
		<tr>
			<td>
				<?php echo $doxod; ?>
			</td>
			<td>
				<?php echo $doxod_field; ?><br>
			</td>
			<td>
				<?php echo $fdoxod; ?>
			</td>
			<td>
				<?php echo $fdoxod_field; ?><br>
			</td>
		</tr>
		</table>
		</fieldset>
		</div>
		<div id="n_4" style="display: none;">
		<fieldset>
		<legend>Участники тура</legend>
		<table width="100%" class="tbl">
		<tr>
			<td colspan="2">
			<?php
				$data = array('name'=>'_clients_rid',
							'id'=>'_clients_rid',
							'type'=>'hidden',
							'value'=>$_clients_rid,
							);
				echo form_input($data);
				$data = array('name'=>'_zk_rid',
							'id'=>'_zk_rid',
							'type'=>'hidden',
							'value'=>$_zk_rid,
							);
				echo form_input($data);
				$data = array('name'=>'_zk_is_tourist',
							'id'=>'_zk_is_tourist',
							'type'=>'hidden',
							'value'=>$_zk_is_tourist,
							);
				echo form_input($data);
			?>
			<script type="text/javascript">
				new Form.Element.Observer('_clients_rid', 1, function (element,value) { new Ajax.Updater('clients_journal','<?php echo site_url(); ?>/demands/uC/'+document.getElementById('_clients_rid').value,{evalScripts:true})})
			</script>
				<?php echo $table; ?>
				<font color="red"><?php echo $this->validation->_clients_rid_error; ?></font><br>
				<font color="red"><?php echo $this->validation->_zk_rid_error; ?></font>
			</td>
		</tr>
		</table>
		</fieldset>
		</div>
		<center>
			<?php echo form_submit('edit_new_submit',$this->lang->line('SAVE')); ?>
		</center>
		<script type="text/javascript">
			RecalcDoxod();
		</script>
		<?php echo form_close(); ?>
	</body>
</html>	
